<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="jgjgdm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jgjgdm">
              <a-input v-model="model.jgjgdm" placeholder="请输入jgjgdm"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="nbjgh" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nbjgh">
              <a-input v-model="model.nbjgh" placeholder="请输入nbjgh"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="ywlx" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ywlx">
              <a-input v-model="model.ywlx" placeholder="请输入ywlx"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jydszjlx" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jydszjlx">
              <a-input v-model="model.jydszjlx" placeholder="请输入jydszjlx"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jydsdm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jydsdm">
              <a-input v-model="model.jydsdm" placeholder="请输入jydsdm"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="ckzhbm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ckzhbm">
              <a-input v-model="model.ckzhbm" placeholder="请输入ckzhbm"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="ckxydm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ckxydm">
              <a-input v-model="model.ckxydm" placeholder="请输入ckxydm"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="xyqsrq" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xyqsrq">
              <j-date placeholder="请选择xyqsrq" v-model="model.xyqsrq"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="xydqrq" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xydqrq">
              <j-date placeholder="请选择xydqrq" v-model="model.xydqrq"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="bz" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bz">
              <a-input v-model="model.bz" placeholder="请输入bz"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jyje" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jyje">
              <a-input-number v-model="model.jyje" placeholder="请输入jyje" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jyjezrmb" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jyjezrmb">
              <a-input-number v-model="model.jyjezrmb" placeholder="请输入jyjezrmb" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jyrq" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jyrq">
              <j-date placeholder="请选择jyrq" v-model="model.jyrq"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jylsh" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jylsh">
              <a-input v-model="model.jylsh" placeholder="请输入jylsh"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="llsp" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="llsp">
              <a-input-number v-model="model.llsp" placeholder="请输入llsp" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jyzhh" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jyzhh">
              <a-input v-model="model.jyzhh" placeholder="请输入jyzhh"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jyzhkhhh" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jyzhkhhh">
              <a-input v-model="model.jyzhkhhh" placeholder="请输入jyzhkhhh"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jydszhh" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jydszhh">
              <a-input v-model="model.jydszhh" placeholder="请输入jydszhh"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="jyfx" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jyfx">
              <a-input v-model="model.jyfx" placeholder="请输入jyfx"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="kmdm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kmdm">
              <a-input v-model="model.kmdm" placeholder="请输入kmdm"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="guid" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="guid">
              <a-input v-model="model.guid" placeholder="请输入guid"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="dataDt" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dataDt">
              <a-input v-model="model.dataDt" placeholder="请输入dataDt"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="legalCode" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="legalCode">
              <a-input v-model="model.legalCode" placeholder="请输入legalCode"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="dataOrg" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dataOrg">
              <a-input v-model="model.dataOrg" placeholder="请输入dataOrg"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="manageDept" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manageDept">
              <a-input v-model="model.manageDept" placeholder="请输入manageDept"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="datasource" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="datasource">
              <a-input v-model="model.datasource" placeholder="请输入datasource"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="dataSharps" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dataSharps">
              <a-input-number v-model="model.dataSharps" placeholder="请输入dataSharps" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="creater" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="creater">
              <a-input v-model="model.creater" placeholder="请输入creater"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="updater" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="updater">
              <a-input v-model="model.updater" placeholder="请输入updater"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="etlDt" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="etlDt">
              <a-input v-model="model.etlDt" placeholder="请输入etlDt"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="subjectNo" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subjectNo">
              <a-input v-model="model.subjectNo" placeholder="请输入subjectNo"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="subjectName" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subjectName">
              <a-input v-model="model.subjectName" placeholder="请输入subjectName"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="khmc" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="khmc">
              <a-input v-model="model.khmc" placeholder="请输入khmc"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="khdm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="khdm">
              <a-input v-model="model.khdm" placeholder="请输入khdm"  ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'JsCdAmtBankDeposit01OldForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model:{
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
           guid: [
              { required: true, message: '请输入guid!'},
           ],
        },
        url: {
          add: "/old/jsCdAmtBankDeposit01Old/add",
          edit: "/old/jsCdAmtBankDeposit01Old/edit",
          queryById: "/old/jsCdAmtBankDeposit01Old/queryById"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
         
        })
      },
    }
  }
</script>